package com.wzp.fulfill.api.rpc.service;

import com.wzp.fulfill.application.command.GetFulfillOrderCommand;
import com.wzp.fulfill.application.command.dto.FulfillOrderDTO;
import com.wzp.fulfill.application.service.FulfillApplicationService;
import com.wzp.fulfill.rpc.FulfillApi;
import com.wzp.fulfill.rpc.dto.FulfillOrderCO;
import org.springframework.beans.factory.annotation.Autowired;

// 加上dubbo的@Service注解，基于dubbo对外提供rpc服务
public class FulfillApiImpl implements FulfillApi {

    @Autowired
    private FulfillApplicationService fulfillApplicationService;

    @Override
    public FulfillOrderCO getFulfillOrderById(Long orderId) {
        GetFulfillOrderCommand getFulfillOrderCommand = new GetFulfillOrderCommand(orderId);
        FulfillOrderDTO fulfillOrderDTO = fulfillApplicationService.executeGetFulfillOrderCommand(getFulfillOrderCommand);
        // 把dto转化为面向客户端的co对象
        return new FulfillOrderCO();
    }

}
